<template>
  <div class="container">
    <el-form ref="ruleForm" :model="ruleForm">
      <el-form-item>
        <el-radio v-model="ruleForm.radio" label="1">通过</el-radio>
        <el-radio v-model="ruleForm.radio" label="2">拒绝</el-radio>
      </el-form-item>
      <el-form-item>
        <el-input
          v-model="ruleForm.desc"
          type="textarea"
          placeholder=" 请输入审核意见"
        />
      </el-form-item>
      <el-form-item style="text-align: center">
        <el-button @click="$emit('close')">取消</el-button>
        <el-button type="primary" @click="auditConfirmation">确认</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { choiceCheck } from '@/api/hmmm/questions'
export default {
  name: 'QuestionsCheck',
  props: {
    reviewInfoId: {
      type: Object,
      default () {
        return []
      }
    }
  },
  data () {
    return {
      // 表单数据
      ruleForm: {
        radio: '1',
        desc: ''
      }
    }
  },
  methods: {
    async auditConfirmation () {
      if (this.ruleForm.desc === '') {
        this.$message({
          message: '请输入审核意见',
          type: 'warning'
        })
      } else {
        this.reviewInfoId.chkState = +this.ruleForm.radio
        this.reviewInfoId.chkRemarks = this.ruleForm.desc
        await choiceCheck(this.reviewInfoId)

        console.log(this.reviewInfoId)
        this.$message({
          message: '操作成功',
          type: 'success'
        })
        this.$emit('requestData')
        this.$emit('close')
      }
    }
  }
}
</script>

<style scoped>
</style>
